#ifndef MUSICINFO_H
#define MUSICINFO_H

#include <QWidget>
#include"tcpclient.h"
namespace Ui {
class MusicInfo;
}

class MusicInfo : public QWidget
{
    Q_OBJECT

public:
    explicit MusicInfo(bool islove,int index,QString title,QString singer,QString collection,QString duraion,QWidget *parent = nullptr);
    MusicInfo(int index=-1,QWidget*parent=nullptr);
    ~MusicInfo();
protected:
    void paintEvent(QPaintEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseDoubleClickEvent(QMouseEvent *event);
private slots:
    void on_love_clicked();

private:
    void initinterface();  //初始化界面
    void initnetwork();    //初始化网络
signals:
    void doubleClicked(tcpclient*client,QString title);

    void addlove(QString title);
    void dellove(QString title);
private:
    Ui::MusicInfo *ui;
    int m_index;            //序号
    QString m_title;        //标题
    QString m_singer;       //歌手
    QString m_collection;   //专辑
    QString m_duration;     //时长
    bool m_islove=false;          //这首歌当前用户是否是喜欢

    //网络
    tcpclient*client;
};

#endif // MUSICINFO_H
